package com.hope.onlinestudy.net

import com.hope.onlinestudy.base.BaseDataModel
import com.hope.onlinestudy.model.*
import com.hope.onlinestudy.utils.ApiUtils
import io.reactivex.Observable
import retrofit2.Response
import retrofit2.http.*


/**
 * @author kazeik chen
 *         QQ:77132995 email:kazeik@163.com
 *         2019 04 17 09:51
 * 类说明:
 */
interface ApiInter {

    @GET(ApiUtils.systemConfig)
    fun getConfig(): Observable<Response<String>>

    @Headers("Domain-Name: token")
    @POST
    @FormUrlEncoded
    fun login(@Url url: String, @Field("message") msg: String?): Observable<Response<LoginModel>>

    @Headers("Domain-Name: token")
    @POST
    @FormUrlEncoded
    fun changepass(
        @Url url: String,
        @Header("JWT_TOKEN") token: String,
        @Field("message") msg: String?
    ): Observable<Response<BaseDataModel<String>>>

    @Headers("Domain-Name: token")
    @POST
    @FormUrlEncoded
    fun getMessage(
        @Url url: String,
        @Header("JWT_TOKEN") token: String,
        @Field("message") msg: String?
    ): Observable<Response<BaseModel<List<MessageModel>>>>

    @Headers("Domain-Name: token")
    @POST
    @FormUrlEncoded
    fun getUserInfo(
        @Url url: String,
        @Header("JWT_TOKEN") token: String,
        @Field("message") msg: String?
    ): Observable<Response<BaseDataModel<List<UserInfoModel>>>>

    @Headers("Domain-Name: token")
    @GET
    fun getAlertMsg(
        @Url url: String,
        @Header("JWT_TOKEN") token: String
    ): Observable<Response<MsgLengthModel>>

    @Headers("Domain-Name: token")
    @GET
    fun deleteSession(
        @Url url: String,
        @Header("JWT_TOKEN") token: String
    ): Observable<Response<BaseDataModel<String>>>

    @Headers("Domain-Name: token")
    @GET
    fun getUserPoint(
        @Url url: String,
        @Header("JWT_TOKEN") token: String,
        @Query("message") msg: String?
    ): Observable<Response<PointListModel>>

    @Headers("Domain-Name: token")
    @POST
    @FormUrlEncoded
    fun updateInfo(
        @Url url: String,
        @Header("JWT_TOKEN") token: String,
        @Field("message") msg: String?
    ): Observable<Response<BaseDataModel<String>>>
}